package com.bigbigrain.jiagou.design.command.impl;

import com.bigbigrain.jiagou.design.command.Command;
import com.bigbigrain.jiagou.design.command.TvReceiver;

/**
 * @description: 关电视命令
 * @author: B1gB1gRA1n
 * @create: 2020-6-1 09:24
 **/
public class TvOffCommand implements Command {
    /**
     * 聚合 tvreceiver对象
     */
    TvReceiver tv;

    public TvOffCommand(TvReceiver tv) {
        this.tv = tv;
    }

    @Override
    public void execute() {
        //调用接收者的方法
        tv.off();
    }

    @Override
    public void undo() {
        //调用接收者的方法
        tv.on();
    }
}
